package com.googlecode.ws.tester.xor.wsdl.model;

import com.googlecode.ws.tester.xor.engine.model.Namespace;

import java.util.List;
import java.util.ArrayList;

/**
 * Created by IntelliJ IDEA.
 * User: pablo
 * Date: 2009-06-09
 * Time: 18:44:58
 */
public class Definitions {

    private Annotation annotation;
    private List<Message> messages;
    private List<Namespace> namespaces;
    private String name;
    private String targetNamespace;
    private PortType portType;

    public PortType getPortType() {
        return portType;
    }

    public void setPortType(PortType portType) {
        this.portType = portType;
    }

    public Definitions() {
    }

    public Annotation getAnnotation() {
        return annotation;
    }

    public void setAnnotation(Annotation annotation) {
        this.annotation = annotation;
    }

    public List<Namespace> getNamespaces() {
        return namespaces;
    }

    public void setNamespaces(List<Namespace> namespaces) {
        this.namespaces = namespaces;
    }

    public void addNamespace(Namespace namespace) {
        if(this.namespaces == null) {
            this.namespaces = new ArrayList<Namespace>();
        }
        this.namespaces.add(namespace);
    }

    public List<Message> getMessages() {
        return messages;
    }

    public void setMessages(List<Message> messages) {
        this.messages = messages;
    }

    public void addMessage(Message message) {
        if(this.messages == null) {
            this.messages = new ArrayList<Message>();
        }
        this.messages.add(message);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getTargetNamespace() {
        return targetNamespace;
    }

    public void setTargetNamespace(String targetNamespace) {
        this.targetNamespace = targetNamespace;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder();
        sb.append("Definitions");
        sb.append("{annotation=").append(annotation);
        sb.append(", messages=").append(messages);
        sb.append(", namespaces=").append(namespaces);
        sb.append(", name='").append(name).append('\'');
        sb.append(", targetNamespace='").append(targetNamespace).append('\'');
        sb.append(", portType=").append(portType);
        sb.append('}');
        return sb.toString();
    }
}
